#include "panel.h"

#include <QFormLayout>
#include <QCheckBox>
#include <QSpinBox>

namespace Ui {

Panel::Panel(QWidget* _parent) : QWidget(_parent) {
	show_points = new QCheckBox("Show Points");
	show_points->setCheckState(Qt::Checked);
	show_convex_hull = new QCheckBox("Show Convex Hull");
	show_convex_hull->setCheckState(Qt::Checked);
	viewport_scale = new QSpinBox();
	viewport_scale->setMaximum(1000);
	viewport_scale->setMinimum(1);
	viewport_scale->setValue(10);

	layout = new QFormLayout();
	layout->addRow("Viewport Range",viewport_scale);
	layout->addRow("", show_points);
	layout->addRow("", show_convex_hull);

	if(_parent) {
		connect(show_points, SIGNAL(stateChanged(int)), _parent, SLOT(points_visualization_changed(int)));
		connect(show_convex_hull, SIGNAL(stateChanged(int)), _parent, SLOT(convex_hull_visualization_changed(int)));
		connect(viewport_scale, SIGNAL(valueChanged(int)), _parent, SLOT(viewport_changed(int)));
	}

	setLayout(layout);
	
}
Panel::~Panel(void) { 
	delete show_points;
	delete show_convex_hull;
	delete viewport_scale;
	delete layout;
}

}
